Database
Database(model_path, *, auto_open=True)
Represents a MIKE+ model database.
Methods
close |
Close the model database. |
create |
Create a new MIKE+ model database. |
open |
Open the model database. |
run |
Run a simulation. |
close
Close the model database.
create
Database.create(
model_path,
*,
projection_string='',
srid=-1,
auto_open=True,
overwrite=False,
)
Create a new MIKE+ model database.
Parameters
model_path |
str or Path |
Path where the new database will be created |
required |
projection_string |
str |
The projection string for the database |
'' |
srid |
int |
The SRID for the database, e.g. 4326 for WGS84 |
-1 |
auto_open |
bool |
If True, immediately open the database connection |
True |
overwrite |
(bool, optional(default is False)) |
If True, overwrite the existing database file if it exists |
False |
Returns
|
Database |
A Database object for the newly created database |
Raises
|
FileExistsError |
If the database already exists (except if overwrite is True) |
open
Open the model database.
run
Database.run(simulation_muid=None, model_option=None)
Run a simulation.
Parameters
simulation_muid |
str |
Simulation MUID. Defaults to the active simulation. |
None |
model_option |
str | MUModelOption |
Model option. Defaults to active model if None. |
None |
Examples
>>> with mp.open("path/to/model.sqlite") as db:
... results = db.run()
>>> with mp.open("path/to/model.sqlite") as db:
... results = db.run("My Simulation")
>>> db = mp.open("path/to/model.sqlite")
>>> results = db.run("My Simulation")
>>> db.close()
Returns
|
list[Path] |
Paths to the result files. |